
import { AudioClip, CCString, Color, JsonAsset, Material, Prefab, SpriteAtlas, SpriteFrame, _decorator, __private } from "cc";
import { Joystick } from "../../Phyic/Joystick/Joystick";
const { ccclass, property } = _decorator;

@ccclass('adConfig')
export class adConfig {
    @property
    platform = "platform";
    @property
    id = 0
    @property({ type: CCString })
    bannerId: string[] = [];
    @property({ type: CCString })
    intersitialId: string[] = [];
    @property({ type: CCString })
    videoId: string[] = [];
    @property({ type: CCString })
    customId: string[] = [];
}
@ccclass('shareContent')
export class shareContent {
    @property
    shareId: string = "";
    @property
    shareLink: string = "";
    @property
    shareText: string = "share tittle";
}

@ccclass('penConfig')
export class penConfig {
    @property
    penName = "default";
    @property(SpriteFrame)
    penSF: SpriteFrame = null;
    @property(Color)
    penColor: Color = new Color();
}

@ccclass('shareConfig')
export class shareConfig {
    @property
    platform = "platform";
    @property({ type: shareContent })
    sharePics: shareContent[] = [];
}
export const collisions = {
    DEFAULT: 1,
    player: 2,
    trap: 4,
    water: 8,
    brick: 16,
    enemy: 32,
}
export interface uiInterface {
    name: string,
    layer: number,
    clear: boolean
}
export type storageKey = {
    name: string,
    type?: DataType,
    default?:any
}
export const RewardIcon = ["coin","heart"];
export enum TaskType{
    GAME,
    QUIZ,
    HEART,
    COIN,
    QUIZLEVEL,
    STORY

}
export enum RewardType{
    COIN,
    HEART
}
export type TaskConfig = {
    type:TaskType,
    goal:number,
    rewardType:RewardType,
    rewardAmount:number
}
export const baseArrTypes = ["Atk", "Def", "Hp", "Skill"];
export const specialArrTypes = ["Crit", "Miss", "Speed", "Dual", "Stun", "Slow", "Counter",
 "LS", "AtkBonus", "SkillBonus", "CritBonus", "HpReg", "Frost", "Dark", "Fire", "Chaos", "Veno"];

export enum equipTypes {
    MELEE,
    RANGE,
    HELMET,
    CLOTH,
    PANTS,
    SHOES,
    AMULET,
}
//atrributes configs
export type atrributes = {
    base: {
        Atk?: number,
        Def?: number,
        Hp?: number,
        Skill?: number,
    },
    special: {
        Crit?: number,
        Miss?: number,
        Speed?: number,
        Dual?: number,
        Stun?: number,
        Slow?: number,
        Counter?: number,
        LS?: number,
        AtkBonus?: number,
        SkillBonus?: number,
        CritBonus?: number,
        HpReg?: number,
        Veno?: number,
        Frost?: number,
        Fire?: number,
        Chaos?: number,
        Dark?: number
    }
}

export interface atributeConfig {
    /* atrribute's name */
    name: string,
    /* atrribute's value number */
    value: number,
    fixed: number,
    /* level index */
    levelindex: number,
    /* rare index */
    rareindex: number,
    randomindex: number
}


export interface equipment {
    id: number,
    name: string;
    type: equipTypes;
    rank:number;
    level?: number;
    attributes?: atrributes,
}
/* for ui prefabs config */
export const ui = {
    BgView: { name: 'BgView', layer: 0, clear: false },
    DecoView: { name: 'DecoView', layer: 1, clear: false },
    ChatView: { name: 'ChatView', layer: 2, clear: false },
    SelectView: { name: 'SelectView', layer: 1, clear: false },
    PromptView: { name: 'PromptView', layer: 3, clear: false },
    ResultView: { name: 'ResultView', layer: 3, clear: false },
    TouchView: { name: 'TouchView', layer: 4, clear: false },
    Joystick: { name: 'Joystick', layer: 3, clear: false },
    AdView: { name: 'AdView', layer: 4, clear: false },
    ToastView: { name: 'ToastView', layer: 5, clear: false },
    WaitView: { name: 'WaitView', layer: 6, clear: false },
    StorySelectView: { name: 'StorySelectView', layer: 2, clear: false },
    GiftView: { name: 'GiftView', layer: 2, clear: false },
    NodeCtrl: { name: 'NodeCtrl', layer: 5, clear: false },
    DesktopView: { name: 'DesktopView', layer: 5, clear: false },
}

export enum itemState {
    OWNEQUIPED,
    EQUIPED,
    NEWEQUIP,
    UNEQUIPED
}
export enum DataType {
    STRING,
    NUMBER,
    OBJECT,
    ARRAY,
    BOOLEAN
}
export enum ChatType {
    /* General Chat */
    DAILY,
    GIFT,
    QUIZ,
    HONG,
    TIAN,
    /* Opponent Chat */
    WANG,
    DUI,
    GANG
}
export interface anmType {
    name: string,
    crossfade:number
}

export const anmClip = {
    dance:{name:"dance",crossfade:0.3},
    idle:{name:"idle",crossfade:0.3},
    walk:{name:"walk",crossfade:0.3},
    victory:{name:"victory",crossfade:0.5},
    talk:{name:"talk",crossfade:0.4},
    cry:{name:"cry",crossfade:0.4},
}

export const aaEvent = {
    desktopTouch: "desktopTouch",
    updateTaskAmount: "updateTaskAmount",
    sellItem: "sellItem",
    collectDiamond: "collectDiamond",
    updateLocal: "updateLocal",
    sellEffect: "sellEffect",
    clearEffect: "clearEffect",
    updateStatus: "updateStatus",
    shakeCam: "shakeCam",
    vibrateCam: "vibrateCam",
    currency: "currency",
    hearts: "hearts",
    storyProgress: "storyProgress",
    angry: "angry",
    levelUp: "levelUp",
    addExp: "addExp",
    startCustom: "startCustom",
    restartGame: "restartGame",
    changeCol: "changeCol",
    initTrap: "initTrap",
    clearMap: "clearMap",
    changePen: "changePen",
    closeGame: "closeGame",
    initLevel: "initLevel",
    gameWin: "gameWin",
    showResult: "showResult",
    toast: "toast",
    anm: "anm",
    functionNotice: "functionNotice",
}
export const Anm = {
    cry: "cry",
    idle: "idle",
    hurt: "hurt",
    happy: "happy",
}

export const Key = {
    NewUser: { name: "NewUser", type: DataType.BOOLEAN,default:true },
    Hearts: { name: "Hearts", type: DataType.NUMBER,default:0.5 },
    CurrentLevel: { name: "CurrentLevel", type: DataType.NUMBER,default:0 },
    PersValue: { name: "PersValue", type: DataType.NUMBER,default:2.5 },
    Hobbies: { name: "Hobbies", type: DataType.STRING,default:null },
    CurrentExp: { name: "CurrentExp", type: DataType.NUMBER,default:0 },
    CharData: { name: "CharacterData", type: DataType.ARRAY, default:[] },
    CurrentChar: { name: "CurrentCharacter", type: DataType.NUMBER, default:0 },
    CurrentTask: { name: "CurrentTask", type: DataType.NUMBER, default:0 },
    CurrentTaskAmount: { name: "CurrentTaskAmount", type: DataType.NUMBER, default:0 },
    Chest: { name: "Chest", type: DataType.NUMBER, default:69 },
    Cash: { name: "Cash", type: DataType.NUMBER, default:100 },
    Diamond: { name: "Diamond", type: DataType.NUMBER, default:1000 },
    Energy: { name: "Energy", type: DataType.NUMBER,default:50 },
    AutoSell: { name: "AutoSell", type: DataType.BOOLEAN,default:true },
}

export const Props = {
    Scenes: "Scenes",
    Layers: "Layers",
    Comps: "Components",
    ShareConfig: "ShareConfig",
    Setting: "Setting",
    View: "View",
    AdConfig: "AdConfig",
    Ad: "Advertisement",
}
export const Jsons = {
    atrributeConfig:"atrributeConfig",
    taskConfig:"taskConfig"
}

export const Clips = {
    hurt: "hurt",
    happy: "happy",
    bgm: "bgm",
    photo: "photo",
    counter: "counter",
    btn: "touch",
    buy: "buy",
    touch: "touch",
    gold: "gold",
    elf: "elf",
    reward: "reward",
    merge: "merge",
    win: "win",
    lose: "lose",
}

export type AssetType = {
    type: any,
    path: string

}
/**
 * assettypes and paths
 */
export const AssetType = {
    Model: { type: Prefab, path: "Preload/Prefabs/Model" } as AssetType,
    Sprite: { type: SpriteFrame, path: "Preload/Sprites" } as AssetType,
    UiPrefab: { type: Prefab, path: "Preload/Prefabs/UI" } as AssetType,
    Json: { type: JsonAsset, path: "Preload/Jsons/" } as AssetType,
    Sound: { type: AudioClip, path: "Preload/Clips/" } as AssetType,
    Atlas: { type: SpriteAtlas, path: "Preload/Atlas/" } as AssetType,
    Material: { type: Material, path: "Preload/Materials/" } as AssetType
}




